/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "ficha_familiar", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "FichaFamiliar.findAll", query = "SELECT f FROM FichaFamiliar f"),
    @NamedQuery(name = "FichaFamiliar.findByIdFichaFamiliar", query = "SELECT f FROM FichaFamiliar f WHERE f.idFichaFamiliar = :idFichaFamiliar"),
    @NamedQuery(name = "FichaFamiliar.findByFicObservaciones", query = "SELECT f FROM FichaFamiliar f WHERE f.ficObservaciones = :ficObservaciones"),
    @NamedQuery(name = "FichaFamiliar.findByFicFechaApertura", query = "SELECT f FROM FichaFamiliar f WHERE f.ficFechaApertura = :ficFechaApertura"),
    @NamedQuery(name = "FichaFamiliar.findByFicCalificaSis", query = "SELECT f FROM FichaFamiliar f WHERE f.ficCalificaSis = :ficCalificaSis")})
public class FamilyRecord implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_ficha_familiar")
    private Integer id;
    @Column(name = "fic_observaciones")
    private String observations;
    @Column(name = "fic_fecha_apertura")
    @Temporal(TemporalType.DATE)
    private Date openingDate;
    @Column(name = "fic_califica_sis")
    private Boolean qualifiesSis;
    @JoinColumn(name = "gru_id_grupo_familiar", referencedColumnName = "id_grupo_familiar")
    @OneToOne(optional = false)
    private FamilyGroup familyGroup;
    @OneToMany(mappedBy = "ficIdFichaFamiliar")
    private List<HomeVisit> homeVisits;

    public FamilyRecord() {
    }

    public FamilyRecord(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getObservations() {
        return observations;
    }

    public void setObservations(String observations) {
        this.observations = observations;
    }

    public Date getOpeningDate() {
        return openingDate;
    }

    public void setOpeningDate(Date openingDate) {
        this.openingDate = openingDate;
    }

    public Boolean getQualifiesSis() {
        return qualifiesSis;
    }

    public void setQualifiesSis(Boolean qualifiesSis) {
        this.qualifiesSis = qualifiesSis;
    }

    public FamilyGroup getFamilyGroup() {
        return familyGroup;
    }

    public void setFamilyGroup(FamilyGroup familyGroup) {
        this.familyGroup = familyGroup;
    }

    public List<HomeVisit> getHomeVisits() {
        return homeVisits;
    }

    public void setHomeVisits(List<HomeVisit> homeVisits) {
        this.homeVisits = homeVisits;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FamilyRecord)) {
            return false;
        }
        FamilyRecord other = (FamilyRecord) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.FamilyRecord[ id=" + id + " ]";
    }
    
}
